package com.lp.enums;

import lombok.Getter;

/**
 * 设备枚举
 *
 * @author lp
 */
@Getter
public enum DeviceEnum {

    PC("电脑端"),
    IPAD("PAD端");

    /**
     * 描述
     */
    private final String describe;

    DeviceEnum(String describe) {
        this.describe = describe;
    }

    /**
     * 根据名称字符串获取对应的枚举值
     *
     * @param name 枚举名称
     * @return 对应的DeviceEnum枚举值
     */
    public static DeviceEnum fromString(String name) {
        for (DeviceEnum device : DeviceEnum.values()) {
            if (device.name().equalsIgnoreCase(name)) {
                return device;
            }
        }
        return null;
    }
}
